<template>
	<view class="adress">
		<view v-if="JSON.stringify(adress) == '{}'">
			<button type="primary" size="mini" @click="getAdress">请选择地址信息</button>
		</view>
		<view class="info" v-else>
			<view class="people">
				<view class="prople-info">收货人：{{adress.userName}}</view>
				<view class="phone">电话:{{adress.telNumber}} ></view>
			</view>
			<view class="people-adress">地址：{{fullAdress}}</view>
		</view>
	</view>
</template>
<script>
	export default {
		data () {
			return {
				adress : {}
			}
		},
		methods : {
			async getAdress() {
				let [err,suc] = await uni.chooseAddress()
				if(err == null && suc.errMsg == 'chooseAddress:ok') {
					this.adress = suc
				}
			}
		},
		computed : {
			fullAdress() {
				return `${this.adress.provinceName || ''}${this.adress.cityName|| ''}${this.adress.countyName|| ''}${this.adress.detailInfo|| ''}`
			}
		}
	}
</script>
<style lang="scss">
	.adress {
		display: flex;
		flex-direction: column;
		justify-content: center;
		align-items: center;
		height: 100px;
		text-align: center;
		border-bottom: 5px dashed skyblue;
		.people {
			display: flex;
			justify-content: space-between;
		}
	}
</style>
